<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>管理系统</title>
<jsp:include page="../../header.jsp"></jsp:include>
<jsp:include page="../../title.jsp"></jsp:include>
</head>
<style>
html,body {
	width: 100%;
	height: 100%;
	margin: 0 auto;
	font-size:12px;
	/* background:#3A6EA5; */
	overflow:hidden;
	overflow-y: hidden;
}
input{
	border:1px solid #9ABAE9;
}
.powerMent{

}
</style>
</head>
<body style="overflow: hidden;">
<DIV id="main-div" style="width:100%;height:100%;overflow:hidden;min-width:900px;" class="divfrist">
		<DIV id="divtop" class="" style="width:100%;float:left;background:url('${pageContext.request.contextPath}/images/deskImage/main_bgColor_0f6b99.gif');background-repeat: repeat">
		</DIV>
		<DIV id="divbottom-left" class=""  style="float:left;">
			<DIV id="start" class="" style="height:24px;margin-top:3px;margin-left:3px;width:74px;float:left;background:url('${pageContext.request.contextPath}/images/deskImage/start_hover.png');">

			</DIV>
		</DIV>
		<DIV id="divbottom-right" class=""  style="float:left;">
			<DIV id="btContent-1" class="" style="width:20px;height:30px;float:left;display:none;">
						<img src="${pageContext.request.contextPath}/images/deskImage/turnTo_left_disable.png" style="margin-top:6px;"></img>
			</DIV>
			<DIV id="btContent-2" class="" style="height:30px;width:1000px;float:left;overflow:hidden;">
					<DIV id="btContent2-1" class="" style="height:24px;margin-top:3px;">
					</DIV>
			</DIV>
			<DIV id="btContent-3" class="" style="width:20px;height:30px;float:right;display:none;">
					<img src="${pageContext.request.contextPath}/images/deskImage/turnTo_right_disable.png" style="margin-top:6px;"></img>
			</DIV>
		</DIV>
 </DIV>
<!-- 隐藏层 -->
		<div id="user_display" style="display: none;overflow: hidden;">
		</div>
		<div id="startc" dis="false" style="width:150px;display:none; position: absolute;margin-left:0px;background: white;border:1px gray solid;padding:4px;">
		</div>
		
	<div id="topmm" class="easyui-menu" style="width:120px;">
		<div data-options="iconCls:'icon22',name:'zmsx'">桌面刷新</div>
		<div data-options="iconCls:'icon22',name:'zmdj'">桌面对齐</div>
		<div data-options="iconCls:'icon-save',name:'zmpz'">桌面配置</div>
		<div data-options="iconCls:'icon-cancel',name:'outlog'">退出系统</div>
	</div>
	<div id="topmm1" class="easyui-menu"  style="width:120px;">
		<div data-options="iconCls:'icon51',name:'hy'">还原</div>
		<div data-options="iconCls:'icon23',name:'zdh'">最大化</div>
		<div data-options="iconCls:'icon1',name:'gb'">关闭</div>
	</div>
	<div id="topmm2" class="easyui-menu"  style="width:120px;">
		<div data-options="iconCls:'icon-cancel',name:'qbgb'">全部关闭</div>
		<div data-options="iconCls:'icon-ok',name:'qbyc'">全部隐藏</div>
	</div>
		<!-- 	<div id="w" class="easyui-window" title="提示" data-options="iconCls:'icon-save',minimizable:false" style="width:500px;height:200px;padding:10px;">
				<h1>IDC项目欢迎你使用！</h1>
		</div> -->


</body>
<SCRIPT type="text/javascript">
(function(){
	
	var zNodes =eval('(${listZtree})');
	
	//改变图片
	for(var i =0;i<zNodes.length;i++){
		zNodes[i].iconSkin=zNodes[i].iconSkin
	}
	var usersetPower=[];//用户自己设置的存到cooking中
	var isstart =true;
	var content="";
	//我的算法很幼稚，不要参考，计算到底目前有多少个页面图标,并给每个图标增加可以移动的区间坐标
	function crateIcon () {
			//计算当前内容高度
			var contentHeight=$("#divtop").height();
			//计算能放多少个
			var cell=100;
			var margin=10;
			var zNodesAll = new Array();
			var castpower = getCookie("${sysUser.sysUserId}_1");		
			var ppowerarr;
			if(castpower!=null&&castpower!=""){
				ppowerarr = castpower.split(",");
			}
			if(ppowerarr==null||ppowerarr==""){
				return;
			}
			for(var i=0;i<zNodes.length;i++){
				if(zNodes[i].power_url.length>0){
					for(var j=0;j<ppowerarr.length;j++){	
						if(zNodes[i].uuid==ppowerarr[j]){
							zNodesAll.push(zNodes[i]);
							break;
						}
					}
				}
			}
			var pc=zNodesAll.length//后台多少个权限
			var number=contentHeight/cell;
			var count=parseInt(pc/number)+1;
			var temp =0;
			var dragright=$("#divtop").width();
			var	dragBottom=$("#divtop").height();
			for(var i=0;i<count;i++){
					for(var j=0;j<number-1;j++){
						if(temp>=pc){
							return;
						}
						var x =(i*cell)+"px";
						var y=(j*cell)+"px";
						var drrigth=dragright-cell-(i*cell);//计算移动x的坐标
						var drbottom=dragBottom-cell-(j*cell);//计算移动y的坐标
						var urlType= zNodesAll[temp].urlType;
						var power_it = zNodesAll[temp].power_it;
						var menu = '<div name="power1"  drleft="'+(i*cell)+'" drtop="'+(j*cell)+'" drright="'+drrigth+'" drbottom="'+drbottom+'" style="width:'+cell+'px;height:'+cell+'px;position: absolute;margin-left:'+x+';margin-top:'+y+'"><div name="power"  treeId="'+zNodesAll[temp].id+'" urlType="'+urlType+'" power_it="'+power_it+'" power_url="'+zNodesAll[temp].power_url+'" iconSkin="'+zNodesAll[temp].iconSkin+'" powerName="'+zNodesAll[temp].name+'"  style="width:'+(cell-margin*2)+'px;height:'+(cell-margin*2)+'px;margin-left:'+margin+'px;margin-top:'+margin+'px;text-align:center;"><button class="'+zNodesAll[temp].iconSkin+'_big" style="width:64px;height:64px;padding-left:13px;padding-top:13px;border:1px solid gray;"></button><div style="text-align:center;">'+zNodesAll[temp].name+'</div></div></div>';
						$("#divtop").append(menu);	
						temp++;
				}
			}
	}
	//初始化右键菜单
	function initTabsMenu(){
		//关闭右键
		$(document).bind('contextmenu',function(e){
					return false;
		});
		$("#topmm").menu({
			onClick:function(itsm){
				if(itsm.name=="zmdj"){
					$("div[name=power1]").remove();
					crateIcon ();
					createStart();
					//addStartClick();
					createPowerclick();
					
				}else if(itsm.name=='zmpz'){
						//用户配置的权限
						var win ='<div id="winSeting" style="width:100%;height:100%;overflow:hidden;"></div>';
						$("#divtop").append(win);
							$('#winSeting').window({
							    title: '桌面权限配置',
							    iconCls:'icon-ok',
							    width: 600,
							    height: 400,
								closed:true,
								inline:true,
							    content:$('<div style="width:100%;height:100%;"></div>').load('${pageContext.request.contextPath}/html/system/user_powerSetting.jsp'),
								onMaximize:function(){					
									this.content=$('<div style="width:100%;height:100%;"></div>').load('${pageContext.request.contextPath}/html/system/user_powerSetting.jsp');
								},
							    onClose:function(){		    	
										$('#winSeting').window('destroy',false);
										$("div[name=power1]").remove();
										crateIcon ();
										initMovePower();
										createStart();
										//addStartClick();
										createPowerclick();
										//$("div").remove("#powerMent"+id);
							    },
								onMinimize:function(){
										$('#winSeting').window('destroy',false);
										$("div[name=power1]").remove();
										crateIcon ();
										initMovePower();
										createStart();
										//addStartClick();
										createPowerclick();
										
									//$("div").remove("#powerMent"+id);
								},
								onRestore:function(){
									this.content=$('<div style="width:100%;height:100%;"></div>').load('${pageContext.request.contextPath}/html/system/user_powerSetting.jsp');
								}
							});
							$('#winSeting').window("open");
				}else if(itsm.name=='outlog'){					
					$.messager.confirm('提示','你确定要退出系统吗？', function(r){		
						if(r){
							$.ajax({
								   type: "POST",
								   url: "${pageContext.request.contextPath}/sys/sysUserAction!outLogin.action",
								   dataType:'text',
								   success: function(msg){
									   window.open("${pageContext.request.contextPath}","_self");
								   }
								});			
						}
					});
				}else if(itsm.name=='zmsx'){
					
					window.location.reload();
				}
			}
		});
		//桌面的右键
		$("#divtop").bind('contextmenu',function(e){
			//e.preventDefault();
			$('#topmm').menu('show', {
				left: e.pageX,
				top: e.pageY
			});
			e.stopPropagation();
			return false;
		});
		//空白的右键
		$("#topmm2").menu({
			onClick:function(itsm){
				if(itsm.name=='qbgb'){
					var arr = new Array();
					for(var i=0;i<$(".powerMent").length;i++){
						 arr.push($($(".powerMent")[i]).attr("winId"));
					
					}
					for(var i=0;i<arr.length;i++){
						$('#win'+arr[i]).window('destroy',false);
					}
					
					$(".powerMent").remove();
					
				}else if(itsm.name=='qbyc'){
					var arr = new Array();
					for(var i=0;i<$(".powerMent").length;i++){
						 arr.push($($(".powerMent")[i]).attr("winId"));					
					}
					for(var i=0;i<arr.length;i++){
						$('#win'+arr[i]).window('destroy',false);
					}
				}
			}
		});
		//下面栏的右键
		$("#divbottom-right").bind('contextmenu',function(e){
			
			$('#topmm2').menu('show', {
				left: e.pageX,
				top: e.pageY
			});
			e.stopPropagation();
			return false;
		});
		
	}
	//增加开始方法

	function createStart(){
					var  menus =$("#startc").css("bottom","30px");
					 $("#startc").attr("dis","true");
					 $("#divtop").append(menus);
	}
	function addStartClick() {

		//改开始的效果
			$("#start").mouseover(function(e){			
				$(this).css("background",'url("${pageContext.request.contextPath}/images/deskImage/start_hover.png")');
				return false;
			}).mouseout(function(e){
				$(this).css("background","url(${pageContext.request.contextPath}/images/deskImage/start_normal.png)");
				return false;
			});
			 $("#start").click(function(e){
				
				if(isstart){
					isstart =false;
					$("#startc").show();
				}else{
					isstart =true;
					$("#startc").hide();
				}
				$(this).css("background","url(${pageContext.request.contextPath}/images/deskImage/start_active.png)");
				return false;
			});
	}
	
	//我的算法很幼稚，不要参考，增加开始的点击效果，他实际上是个隐藏的层
	function createPowerclick () {
		$("div[name=power]").dblclick(powerImgOnClick);
	}
	//显示权限的事件
	function powerImgOnClick(){
		var treeId = $(this).attr("treeId");
		var treeName = $(this).attr("powerName");
		var treeUrl = $(this).attr("power_url");
		if(treeUrl==null||treeUrl==""){
			return;
		}
		var treeIcon = $(this).attr("iconSkin");
		var urlType = $(this).attr("urlType");
		var power_it = $(this).attr("power_it");
		//打开一个窗口
		var window1= adduser($(this));
		if(window1==1){
			return;
		}
		if(treeName.length>4){
			treeName =treeName.substring(0,4);
			treeName+="..";
		}
		$(".powerMent").css({background:"url('${pageContext.request.contextPath}/images/deskImage/btn_normal.png')"});
		var powerContent ='<DIV id="powerMent'+treeId+'" winId="'+treeId+'" class="powerMent"  ison="true" style="height:24px;margin-left:3px;background:url(${pageContext.request.contextPath}/images/deskImage/btn_active.png);width:100px;float:left;"><div style="float:left;"><button class='+treeIcon+' style="margin-top:4px;margin-left:6px;border:0px;width:16px;height:16px;"></button></div><div style="text-algin:center;margin-top:4px;float:left;width:60px;margin-left:4px;">'+treeName+'</div></DIV>';
		$("#btContent2-1").append(powerContent);
		$("#powerMent"+treeId).attr("treeId",treeId);
		$("#powerMent"+treeId).attr("powerName",treeName);
		$("#powerMent"+treeId).attr("power_url",treeUrl);
		$("#powerMent"+treeId).attr("iconSkin",treeIcon);
		$("#powerMent"+treeId).attr("power_it",power_it);
		//加载点击事件
		$("#powerMent"+treeId).click(function(event){
				$(".powerMent").css({background:"url('${pageContext.request.contextPath}/images/deskImage/btn_normal.png')"});
				$(this).css("background-image","url('${pageContext.request.contextPath}/images/deskImage/btn_active.png')");
				adduser($(this));
				event.stopPropagation();
				
		}).dblclick(function(){
			var botbuttonId =$(this).attr("treeId");
			$('#win'+botbuttonId).window('destroy',false);
			adduser($(this));
			//$('#win'+botbuttonId).window('maximize');
			//加载右键事件
		}).bind('contextmenu',function(e){		
			//e.preventDefault();
			//拿到这个id
			var botbuttonId =$(this).attr("treeId");
			var self =$(this);
			//以下是右键的功能
			$('#topmm1').menu({
				onClick:function(itsm){
					if(itsm.name=='hy'){
						$('#win'+botbuttonId).window('destroy',false);
						adduser(self);
					}else if(itsm.name=='zdh'){
						adduser(self);
						$('#win'+botbuttonId).window('maximize');
					}else if(itsm.name=='gb'){
						$('#win'+botbuttonId).window('destroy',false);
						$("div").remove("#powerMent"+botbuttonId);
					} 
				}
			});
			$('#topmm1').menu('show', {
				left: e.pageX,
				top: e.pageY
			});
			return false;
		});
		var chidrenSize=$("#btContent2-1").children().length;
		var max=chidrenSize*3+chidrenSize*100;
		if(max>$("#btContent2-1").width()){
				$("#btContent-1").show();
				$("#btContent-3").show();
				$("#btContent2-1").width(max);
		}
	}
	//打开弹窗
	//var win1=0;
	var windowW=$(window).width();
	var windowH=$(window).height();
	function adduser(self){

		var id = $(self).attr("treeId");
		var treeName = $(self).attr("powerName");
		var treeUrl = $(self).attr("power_url");
		
		var treeIcon = $(self).attr("iconSkin");
		var urlType = $(self).attr("power_it");
		if($('#win'+id).length>0){
			$('#win'+id).window("open");
			return 1;
		}
		var win ='<div id="win'+id+'" style="width:100%;height:100%;"></div>';
		$("#divtop").append(win);
		if(urlType==1){
			$('#win'+id).window({
			    title: treeName,
			    iconCls:treeIcon,
			    width: windowW*0.7,
			    collapsible:false,
			    height: windowH*0.7,
				closed:true,
				minimizable:true,
				inline:true,
			    content:$('<div style="width:100%;height:100%;"></div>').load(treeUrl),
				onMaximize:function(){					
					this.content=$('<div style="width:100%;height:100%;"></div>').load(treeUrl);
				},
			    onClose:function(){		    	
						$('#win'+id).window('destroy',false);
						$("div").remove("#powerMent"+id);
			    },
				onMinimize:function(){
					$('#win'+id).window('destroy',false);
					//$("div").remove("#powerMent"+id);
				},
				onRestore:function(){
					
					this.content=$('<div style="width:100%;height:100%;"></div>').load(treeUrl);
				}
			});
		}else{
			$('#win'+id).window({
			    title: treeName,
			    iconCls:treeIcon,
			    width: windowW*0.7,
			    height: windowH*0.7,
			    collapsible:false,
			    minimizable:true,
				closed:true,
				inline:true,
			    content:$('<div style="width:100%;height:100%;overflow:hidden;"></div>').html('<iframe width="100%"  style="border:0px;overflow:hidden;" height="100%" src="'+treeUrl+'"></iframe>'),
				onMaximize:function(){
					
					this.content=$('<div style="width:100%;height:100%;overflow:hidden;"></div>').html('<iframe width="100%" height="100%"  style="border:0px;overflow:hidden;" src="'+treeUrl+'"></iframe>');
				},
			    onClose:function(){		    	
						$('#win'+id).window('destroy',false);
						$("div").remove("#powerMent"+id);
			    },
				onMinimize:function(){
					$('#win'+id).window('destroy',false);
					//$("div").remove("#powerMent"+id);
				},
				onRestore:function(){
					
					this.content=$('<div style="width:100%;height:100%;overflow:hidden;"></div>').html('<iframe width="100%"  style="border:0px;overflow:hidden;"  height="100%" src="'+treeUrl+'"></iframe>');
				}
			});
			
		}
		
		$('#win'+id).window('open');
		return 0;

	}
	function initMovePower(){
		//我的算法很幼稚，不要参考，
		//计算移动区间的移动方法
		function onDrag(e){
			var drleft=$(this).attr("drleft");
			var drtop=$(this).attr("drtop");
			var drright=$(this).attr("drright");
			var drbottom=$(this).attr("drbottom");
			var d = e.data;
			if (d.left < -drleft){d.left = -drleft}
			if (d.top < -drtop){d.top = -drtop}
			if(d.left>drright){d.left=drright}
			if(d.top>drbottom){d.top=drbottom}
		}
		$("div[name=power1]").draggable({
				onDrag:onDrag
		});
	}
	function initbody() {

			$("#divtop").height($("#main-div").height()-30);
			$("#divbottom-left").height(30);
			$("#divbottom-right").height(30);
			$("#divbottom-left").width(80);
			$("#divbottom-right").width($("#main-div").width()-81);
			 crateIcon ();
			 createStart();
			 addStartClick();
			 createPowerclick();
			var btContentCW=$("#btContent-1").parent().width();
			var bt1w=$("#btContent-1").width();
			var bt3w=$("#btContent-3").width();
			$("#btContent-2").width(btContentCW-bt1w-bt3w-2);
			var moveW=200;
			//以下一段是计算点开的窗口多了，就要左右移动的状态
			//我的算法很幼稚，不要参考，
			$("#btContent-1").click(function(){
						$("#btContent2-1").stop();
					  var maxw =$("#btContent2-1").width()-$("#btContent-2").width();
					  var marginleft =$("#btContent2-1").css("marginLeft");
						  marginleft=marginleft.replace("px","");
					  if(parseInt(marginleft-200)<-maxw){
							  $("#btContent2-1").animate({marginLeft: -maxw+"px"}, "200");
					  }else{
							  $("#btContent2-1").animate({marginLeft: "-=200px"}, "200");
					  }
			});
			//以下一段是计算点开的窗口多了，就要左右移动的状态
			//我的算法很幼稚，不要参考，
			$("#btContent-3").click(function(){
					  $("#btContent2-1").stop();
					  var maxw =$("#btContent2-1").width()-$("#btContent-2").width();
					  var marginleft =$("#btContent2-1").css("marginLeft");
						  marginleft=marginleft.replace("px","");
					  if(marginleft=="auto"){
						marginleft=0;
					  }
					  if(parseInt(marginleft)<=0&&parseInt(marginleft)>=-200){
							  $("#btContent2-1").animate({marginLeft: "0px"}, "200");
					  }else{
							  $("#btContent2-1").animate({marginLeft: "+=200px"}, "200");
					  }
			})
			initMovePower();
			$("#divtop").click(function(){
					$("#startc").hide();
					$("#accion").hide();
					$("div[name=childPwerList]").hide();
			});
//========================开始！！！========================
	
		function  initPower() {
			var firstPid =0;
			if(zNodes.length>0){
						var b = false;
						var powerList =$('<div style="width:100%;height:100%;"></div>');
						for (var i=0; i<zNodes.length; i++) {
							
							if(zNodes[i].pId==0){
    								var childePower ='<div  treeId="'+zNodes[i].id+'" power_it="'+zNodes[i].power_it+'" urlType="'+zNodes[i].urlType+'" powerName="'+zNodes[i].name+'" iconSkin="'+zNodes[i].iconSkin+'"  id="powerdiv'+zNodes[i].id+'" zid="'+zNodes[i].id+'" zpid="'+zNodes[i].pId+'" power_url="'+zNodes[i].power_url+'" name="childePower" style="width:100%;height:30px;float:left;padding-top:7px;"><div><button class="'+zNodes[i].iconSkin+'" style="width:16px;height:18px;border:0px;"></button><span style="margin-left:10px;">'+zNodes[i].name+'</span></div></div>';									
    								powerList.append(childePower);
    							
    							
								//将来需要改
									b=true;
								}
						}
						//这里的菜单不能超过当前桌面的有效高度，将来的算法需要改动
						if((powerList.children().length)*30>$("#divtop").height()){
								powerList.css("height",$("#divtop").height()+"px");
						}else{
								powerList.css("height",(powerList.children()+14)*30+"px");
						}
						//循环递归调用
							powerList.css("left","0px");
							powerList.css("bottom","0px");
							$("#startc").append(powerList);
							$($("#startc").children()[0]).children().mouseover(function(){
									$(this).css("background","#0f6b99");
									for (var i=0; i<$(this).nextAll().length; i++) {
										var temp =$(this).nextAll()[i];
										//所有生成的对应层要全部隐藏
										$(temp).css("background","white");
										var tempzid =$(temp).attr("zid");
										$("div[childpwerlist="+tempzid+"]").hide();
										//下下级全部隐藏

									}
									for (var i=0; i<$(this).prevAll().length; i++) {
										var temp =$(this).prevAll()[i];
										//所有生成的对应层要全部隐藏
										$(temp).css("background","white");
										var tempzid =$(temp).attr("zid");
										$("div[childpwerlist="+tempzid+"]").hide();
										//上上级全部隐藏
									}
									//$(this).nextAll().css("background","white");
									//$(this).prevAll().css("background","white");
							});
							
							powerList.children().mouseover(function(){childePowerChange(this);}).click(powerImgOnClick);
							//powerList.show();
			}
		}
		function childePowerChange(self) {
			try {
				$(self).css("background","#0f6b99");
				var my =$(self);
				var zid = $(self).attr("zid");
				var pid =$(self).attr("zpid");
				var powerList;
				if($("div[childPwerList="+zid+"]").length>=1){
						$("div[childPwerList="+zid+"]").html("");
						powerList=$("div[childPwerList="+zid+"]");
				}else{
						powerList =$('<div name="childPwerList" pid="'+pid+'" childPwerList="'+zid+'" style="display:none; position: absolute;background:white;width:150px;padding:4px;border:1px solid gray;overflow-x:auto;"></div>');
				}
				var b = false;
				for (var i=0; i<zNodes.length; i++) {
										
					if(zNodes[i].pId==zid){
							var childePower ='<div  treeId="'+zNodes[i].id+'" power_it="'+zNodes[i].power_it+'"   urlType="'+zNodes[i].urlType+'" powerName="'+zNodes[i].name+'" iconSkin="'+zNodes[i].iconSkin+'"  id="powerdiv'+zNodes[i].id+'" zid="'+zNodes[i].id+'" zpid="'+zNodes[i].pId+'" power_url="'+zNodes[i].power_url+'" name="childePower" style="width:100%;height:30px;float:left;padding-top:7px;"><div><button class="'+zNodes[i].iconSkin+'" style="width:16px;height:18px;border:0px;"></button><span style="margin-left:10px;">'+zNodes[i].name+'</span></div></div>';
								powerList.append(childePower);
								
								//将来需要改动
								$("#powerdiv"+zNodes[i].id).click(powerImgOnClick);
								b=true;
						}
				}
				//这里的菜单不能超过当前桌面的有效高度，将来的算法需要改动
				if((powerList.children().length)*30>$("#divtop").height()){
						powerList.css("height",$("#divtop").height()+"px");
				}else{
						powerList.css("height",(powerList.children()+14)*30+"px");
				}
				powerList.children().mouseover(function(){childePowerChange(this);});
				//如果没有下一级，同样的也要隐藏显示的
						if(b==false){
								$(self).nextAll().css("background","white");
								$(self).prevAll().css("background","white");
								//需要隐藏
								hideChilren($(self).attr("zpid"),$(self).attr("zid"));

							return;
						}
						var thisleft = $(self).offset().left+$(self).width();
						var thistop = $(self).offset().top;
						var allHeight=$("#divtop").height();
						if(allHeight-thistop>(powerList.children().length*(30+7)+8)){
							powerList.css("margin-top",thistop-4);
							powerList.css("margin-left",thisleft+4);
							powerList.show();
							$("#divtop").append(powerList);
						}else{
							powerList.css("bottom","30px");
							powerList.css("margin-left",thisleft+4);
							powerList.show();
							$("#divtop").append(powerList);
						}

					$(self).nextAll().css("background","white");
					$(self).prevAll().css("background","white");
					hideChilren($(self).attr("zpid"),$(self).attr("zid"));
			}catch (e) {
				alert(e);
			}
		}
		function hideChilren(pid,zid) {

			var allborer=getPrve(pid);
			var carry = new Array();
			for (var i=0; i<allborer.length; i++) {
					if(allborer[i].id!=zid){
						carry.push(allborer[i]);
						$("div[childpwerlist="+allborer[i].id+"]").hide();
					}
			}
			for (var i=0; i<carry.length; i++) {
				var cr =getChildeDivZid(carry[i].id);
				//alert(i+"===cr"+cr.length);
				for (var j=0; j<cr.length; j++) {
					$("div[childpwerlist="+cr[j].id+"]").hide();
				}
			}
		}
		initPower();
//======================结局=========================
			//左移的时候去改前景图片
			$("#btContent-1").mouseover(function(){
				$($(this).children()[0]).attr("src","${pageContext.request.contextPath}/images/deskImage/turnTo_left_hover.png");
			}).mouseout(function(){
				$($(this).children()[0]).attr("src","${pageContext.request.contextPath}/images/deskImage/turnTo_left_disable.png");
			}).click(function(){
				$($(this).children()[0]).attr("src","${pageContext.request.contextPath}/images/deskImage/turnTo_left_active.png");
			});
			//左移的时候去改前景图片
			$("#btContent-3").mouseover(function(){
				$($(this).children()[0]).attr("src","${pageContext.request.contextPath}/images/deskImage/turnTo_right_hover.png");
			}).mouseout(function(){
				$($(this).children()[0]).attr("src","${pageContext.request.contextPath}/images/deskImage/turnTo_right_disable.png");
			}).click(function(){
				$($(this).children()[0]).attr("src","${pageContext.request.contextPath}/images/deskImage/turnTo_right_active.png");
			});
			//子集返回方法
			function getChildeDivZid(zid){
					var childNodes = new Array();
					 eachZid(zNodes,zid,childNodes);
					 return childNodes;
			}
			//返回同级的方法
			function getPrve(pId){
				var prveList = new Array();
				for (var i=0; i<zNodes.length; i++) {
					if(zNodes[i].pId==pId){
						prveList.push(zNodes[i]);
					}
				}
				return prveList;
			}
			//递归得到自己的所有子集
			function eachZid(allNodes,id,childNodes) {
				for (var i=0; i<allNodes.length; i++) {
					if(allNodes[i].pId==id){
						childNodes.push(allNodes[i]);
							eachZid(allNodes,allNodes[i].id,childNodes);
					}
				}
			}
	}
	$(function(){
			initbody();
			initTabsMenu();
			$(window).resize(function(){
					document.location.reload();
			});
	});
})();
</SCRIPT>
</html>